﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGsGeomPortion : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGsGeomPortion(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGsGeomPortion obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGsGeomPortion()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGsGeomPortion(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdGsLayerNode m_pLayer
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGsGeomPortion_m_pLayer_get(this.swigCPtr);
				OdGsLayerNode result = (intPtr == IntPtr.Zero) ? null : new OdGsLayerNode(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGsGeomPortion_m_pLayer_set(this.swigCPtr, OdGsLayerNode.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdRxObject m_pGsMetafile
		{
			get
			{
				OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGsGeomPortion_m_pGsMetafile_get(this.swigCPtr), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGsGeomPortion_m_pGsMetafile_set(this.swigCPtr, OdRxObject.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdGsGeomPortion m_pNext
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGsGeomPortion_m_pNext_get(this.swigCPtr);
				OdGsGeomPortion result = (intPtr == IntPtr.Zero) ? null : new OdGsGeomPortion(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGsGeomPortion_m_pNext_set(this.swigCPtr, OdGsGeomPortion.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdGsGeomPortion() : this(GlobalsPINVOKE.new_OdGsGeomPortion(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void copyFrom(OdGsGeomPortion c)
		{
			GlobalsPINVOKE.OdGsGeomPortion_copyFrom(this.swigCPtr, OdGsGeomPortion.getCPtr(c));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void clear()
		{
			GlobalsPINVOKE.OdGsGeomPortion_clear(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
